import 'dart:ffi';

import 'package:hrf_app/pages/main_tab/main_menu_tab/widgets/menu_data_handler.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class MainMenuTabController extends GetxController {
  MainMenuTabController();

  late List<MenuItemModel> menuItemModelList;

  _initData() {
    update(["main_menu_tab"]);
  }

  void onTap() {}

  @override
  void onInit() {
    MenuDataHandler menuDataHandler = MenuDataHandler();
    menuItemModelList = menuDataHandler.initializeMenuList();
    super.onInit();
  }

  @override
  void onReady() {
    super.onReady();
    _initData();
  }

  jumpToPage(MenuItemModel router) {
    debugPrint(router.router);
    Get.toNamed(router.router, arguments: router.params);
  }

// @override
// void onClose() {
//   super.onClose();
// }
}

///菜单数据模型
class MenuItemModel {
  final String name;

  //夜间模式下的背景颜色
  final Color color;

  final Color darkColor;
  final String router;
  final String hasPerm;
  final int? num;
  final dynamic? params;
  List<MenuItemModel>? children;

  MenuItemModel(
      {required this.name,
      required this.color,
      required this.darkColor,
      required this.router,
      required this.hasPerm,
      this.num,
      this.params,
      this.children});
}
